# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=jd-gui
pkgver=1.6.6
pkgrel=3
groups=('blackarch' 'blackarch-decompiler' 'blackarch-reversing')
pkgdesc='A standalone graphical utility that displays Java source codes of .class files.'
arch=('x86_64' 'aarch64')
url='https://github.com/java-decompiler/jd-gui'
license=('custom')
depends=('java-environment' 'libxtst')
options=('!strip')
source=("https://github.com/java-decompiler/$pkgname/releases/download/v$pkgver/$pkgname-$pkgver.jar")
noextract=("$pkgname-$pkgver.jar")
sha512sums=('ac05eade3bc70ac72fe92d52f178a4a8a028f00430fa709bcbd4e43564589339e731eb2111c9ef64c0bed26f2edbb510afafc73a4891d0bd018e813539ac1227')

package() {
  install -dm 755 "$pkgdir/usr/bin"

  install -Dm 644 "jd-gui-$pkgver.jar" \
    "$pkgdir/usr/share/$pkgname/$pkgname-$pkgver.jar"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
exec java -jar /usr/share/$pkgname/$pkgname-$pkgver.jar "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

